import { APPCODE } from "./config";
import axios from "axios"

export async function getNewsChannels(){
  var res =  await axios.get("http://ali-news.showapi.com/channelList",{headers:{Authorization:`APPCODE ${ APPCODE }`}});
//   console.log(res.data.showapi_res_body.channelList)
return res.data.showapi_res_body.channelList

}

export async function getNews(channelId,page=1,maxResult=10,needContent=1){
    var res= await axios.get("http://ali-news.showapi.com/newsList",{
        headers:{Authorization:`APPCODE ${APPCODE}`},
        params:{channelId,page,maxResult,needContent}

    })
    // console.log(res.data.showapi_res_body.pagebean.contentlist)
    return res.data.showapi_res_body.pagebean.contentlist
}

